//
//  WYWDownLoader.h
//  WYWDownloader
//
//  Created by Mr.Run on 2017/11/6.
//  Copyright © 2017年 Mr.Run. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, WYWDownLoadState) {
    WYWDownLoadStatePause,
    WYWDownLoadStateDownLoading,
    WYWDownLoadStatePauseSuccess,
    WYWDownLoadStatePauseFailed,
};

typedef void(^DownLoadInfoType)(long long totalSize);
typedef void(^ProgressBlockType)(CGFloat progress);
typedef void(^SuccessBlockType)(NSString *cachePath);
typedef void(^FailedBlockType)();
typedef void(^StateChangeType)(WYWDownLoadState state);

@interface WYWDownLoader : NSObject

-(void)downLoader:(NSURL*)url downLoadInfo:(DownLoadInfoType)downLoadInfo progress:(ProgressBlockType)progress success:(SuccessBlockType)success failed:(FailedBlockType)failed;

-(void)downLoader:(NSURL*)url;

-(void)pauseCurrentTask;

-(void)cancelCurrentTask;

-(void)cancelAndClean;

-(void)resumeCurrentTask;

@property (nonatomic,readonly,assign) WYWDownLoadState state;
@property (nonatomic,readonly,assign) CGFloat progress;

@property (nonatomic,copy) DownLoadInfoType downLoadInfo;
@property (nonatomic,copy) StateChangeType stateChange;
@property (nonatomic,copy) ProgressBlockType progressChange;
@property (nonatomic,copy) SuccessBlockType successBlock;
@property (nonatomic,copy) FailedBlockType failedBlock;

@end
